home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-01-29 | 1.4 KB | 53 lines | [TEXT/PJMM] |
- {*****************************}
- {********* SAT Collision **********}
- {*****************************}
-
- {A SAT demo that is slightly over SATminimal, demonstrating the simplest}
- {collision handling based on the kind field (KindCollision).}
-
- program SATcollision;
-
- uses
- {$ifc UNDEFINED THINK_PASCAL}
- Types, QuickDraw, Events, Windows, Dialogs, Fonts, DiskInit, TextEdit, Traps, Desk, Memory, SegLoad, Scrap, ToolUtils, OSEvents, OSUtils, Menus, Resources, StandardFile, GestaltEqu, Files, Errors,
- {$endc}
- SAT, sMrEgghead, sApple;
-
- var
- ignoreSp: SpritePtr;
- l: longint;
- p: Point;
- begin
- {Standard Inits are done by Think Pascal.}
- {$IFC UNDEFINED THINK_PASCAL}
- SATInitToolbox;
- {$ENDC}
-
- {Initialize SAT}
- SATConfigure(true, kVPositionSort, kKindCollision, 32);
- SATInit(128, 129, 512, 322);
-
- {Initialize sprite units}
- InitMrEgghead;
- InitApple;
-
- {Make sprites}
- GetMouse(p); {We get the mouse position in order to put Mr Egghead under it immediately}
- ignoreSp := SATNewSprite(0, p.h, p.v, @SetupMrEgghead);
- ignoreSp := SATNewSprite(0, 0, SATRand(gSAT.offSizeV - 32), @SetupApple);
-
- HideCursor;
-
- repeat
- l := TickCount;
- SATRun(true); {Run a frame of animation}
- while l > TickCount - 3 do {Speed limit}
- ;
-
- {Start a new apple once in a while}
- if SATRand(40) = 1 then
- ignoreSp := SATNewSprite(0, 0, SATRand(gSAT.offSizeV - 32), @SetupApple);
- until Button;
- ShowCursor;
- SATSoundShutUp; {Always make sure the sound channel is de-allocated!}
- end.